const state = () => ({
    HasPermision: {
        routers: [],
        widgets: []
    },
});

const mutations = {
    setHasPermision(state, val) {
        state.HasPermision = val;
    },
};

const actions = {
    setHasPermision({commit}) {
        // @ts-ignore
        this.$axios.get("/new/systemctl/getpermisions").then(res => {
            console.log(res,);
            if (res && res.status === 200) {
                const data = res.data.data;
                const value = {
                    routers: data.routers,
                    widgets: data.widgets,
                }
                commit("setHasPermision", value);
            }
        })
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
